package J2ME_LoverTest;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class LoverTestMIDlet extends MIDlet {
    private Display dis;
    private WelcomeCanvas wc=new WelcomeCanvas(this);
    private ChoiceHostList chl=new ChoiceHostList(this);
    private LoverGameCanvas lgc;     //Haven't decide the param which would send to  construct LoverGameCanvas class
    private GameOverCanvas goc;      //need the param int score
    
    
    
	public LoverTestMIDlet() {
		dis=Display.getDisplay(this);
		
		
	}
	
	protected void startApp() throws MIDletStateChangeException {
		
         this.changeInterface("WelcomeCanvas");
         
	}
	
	public void changeInterface(String Interface){
		if(Interface.equals("WelcomeCanvas")){
			dis.setCurrent(wc);
		}
		else if(Interface.equals("ChoiceHostList")){
		    
			dis.setCurrent(chl);
			
			
		}
		else if(Interface.equals("LoverGameCanvas")){
			int host=chl.choose+1;
			System.out.println(host);
			lgc=new LoverGameCanvas(this,host);
			dis.setCurrent(lgc);
		}
		else if(Interface.equals("GameOverCanvas")){
			int score=lgc.score;
			goc=new GameOverCanvas(this,score);
			dis.setCurrent(goc);
		}
	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	

}
